package com.czy.owner.net.exception;

/**
 * 自定义错误信息，统一处理返回处理
 * Created by wangyang on 2017/4/26.
 */
public class HttpTimeException extends RuntimeException {

    public static final int NO_DATA = 0x2;
    private String exp ;
    // TODO modified by King 2017/07/10:网络状态码
    private boolean isCodeError = false;


    public HttpTimeException(String exp) {
        super(exp);
        this.exp = exp;
    }

    public HttpTimeException(String exp,boolean isCodeError) {
        super(exp);
        this.exp = exp;
        this.isCodeError = isCodeError;
    }

    public void setExp(String exp) {
        this.exp = exp;
    }

    public String getExp() {
        return exp;
    }

    public boolean isCodeError() {
        return isCodeError;
    }

    /**
     * 转换错误数据
     *
     * @param code
     * @return
     */
    private  String getApiExceptionMessage(int code) {
        String message = "";
        switch (code) {
            case NO_DATA:
                message = "无数据";
                break;
            default:
                message = exp;
                break;

        }
        return message;
    }
}

